﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using System.Data.SqlClient;
using System.IO;

namespace PlanningDepartment
{
    public partial class Fr_Report : Telerik.WinControls.UI.RadForm
    {
        public Fr_Report()
        {
            InitializeComponent();
        }
        private void ChangeThemeName(Control control, string themeName)
        {
            IComponentTreeHandler radControl = control as IComponentTreeHandler;
            if (radControl != null) { radControl.ThemeName = themeName; }
            foreach (Control child in control.Controls)
            { ChangeThemeName(child, themeName); }
        }

        private void Fr_Report_Load(object sender, EventArgs e)
        {
            //ChangeThemeName(this, "Office2010Black");
        }
        public void CrR_PhachSC_ReportKG(DataSet ds, string Date, string GhiChu)
        {
            CrR_PhachSC_ReportKG CrKTGTH = new CrR_PhachSC_ReportKG();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            ParameterValues pav2 = new ParameterValues();
            ParameterDiscreteValue padv2 = new ParameterDiscreteValue();
            padv2.Value = GhiChu;
            pav2.Add(padv2);
            CrKTGTH.DataDefinition.ParameterFields["GhiChu"].ApplyCurrentValues(pav2);


            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_GoTron_ReportKG(DataSet ds, string Date, string GhiChu)
        {
            CrR_GoTron_ReportKG CrKTGTH = new CrR_GoTron_ReportKG();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            ParameterValues pav2 = new ParameterValues();
            ParameterDiscreteValue padv2 = new ParameterDiscreteValue();
            padv2.Value = GhiChu;
            pav2.Add(padv2);
            CrKTGTH.DataDefinition.ParameterFields["GhiChu"].ApplyCurrentValues(pav2);


            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_NK_PhachSC(DataSet ds, string Date)
        {
            CrR_KG_NKPhachSC CrKTGTH = new CrR_KG_NKPhachSC();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
           


            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_NK_GoTron(DataSet ds, string Date)
        {
            CrR_KG_NKGoTron CrKTGTH = new CrR_KG_NKGoTron();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);



            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_XK_PhachSC(DataSet ds, string Date)
        {
            CrR_KG_XKPhachSC CrKTGTH = new CrR_KG_XKPhachSC();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_XK_GoTron(DataSet ds, string Date)
        {
            CrR_KG_XKGoTron CrKTGTH = new CrR_KG_XKGoTron();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);



            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_GoDangSay(DataTable ds)
        {
            CrR_LS_PhachDangSay CrKTGTH = new CrR_LS_PhachDangSay();
            CrKTGTH.SetDataSource(ds);
            

            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_LS_NKPhachSC(DataSet ds, string Date)
        {
            CrR_LS_NKPhachSC CrKTGTH = new CrR_LS_NKPhachSC();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);



            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_LS_NKGoTron(DataSet ds, string Date)
        {
            CrR_LS_NKGoTron CrKTGTH = new CrR_LS_NKGoTron();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();
        }
        public void CrR_KG_NhapKho(DataSet ds, string Date)
        {
            CrR_KG_NhapKho CrKTGTH = new CrR_KG_NhapKho();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();
        }
        public void CrR_KG_XuatKho(DataSet ds, string Date)
        {
            CrR_KG_XuatKho CrKTGTH = new CrR_KG_XuatKho();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void CrR_LS_NhapKho(DataSet ds, string Date)
        {
            CrR_LS_VaoLo CrKTGTH = new CrR_LS_VaoLo();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();
        }
        public void CrR_LS_XuatKho(DataSet ds, string Date)
        {
            CrR_LS_RaLo CrKTGTH = new CrR_LS_RaLo();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Date;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();
        }
        public void report_TDKH_Nhung(DataSet ds)
        {
            CrR_TDKH_Nhung CrNKTG = new CrR_TDKH_Nhung();
            CrNKTG.SetDataSource(ds.Tables[0]);
            crystalReportViewer1.ReportSource = CrNKTG;
            crystalReportViewer1.Refresh();
        }
        public void report_inputNVL(DataSet ds,string UserName)
        {
            CrR_NVL_NhapKho CrNKTG = new CrR_NVL_NhapKho();
            CrNKTG.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = UserName;
            pav1.Add(padv1);
            CrNKTG.DataDefinition.ParameterFields["User"].ApplyCurrentValues(pav1);

            crystalReportViewer1.ReportSource = CrNKTG;
            crystalReportViewer1.Refresh();
        }
        public void report_inputNVLTH(DataSet ds, string UserName)
        {
            CrR_NVL_NhapKhoTH CrNKTG = new CrR_NVL_NhapKhoTH();
            CrNKTG.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = UserName;
            pav1.Add(padv1);
            CrNKTG.DataDefinition.ParameterFields["User"].ApplyCurrentValues(pav1);

            crystalReportViewer1.ReportSource = CrNKTG;
            crystalReportViewer1.Refresh();
        }
        public void report_outputNVL(DataSet ds, string UserName)
        {
            CrR_NVL_XuatKho CrNKTG = new CrR_NVL_XuatKho();
            CrNKTG.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = UserName;
            pav1.Add(padv1);
            CrNKTG.DataDefinition.ParameterFields["User"].ApplyCurrentValues(pav1);

            crystalReportViewer1.ReportSource = CrNKTG;
            crystalReportViewer1.Refresh();
        }
        public void report_outputNVLTH(DataSet ds, string UserName)
        {
            CrR_NVL_XuatKhoTH CrNKTG = new CrR_NVL_XuatKhoTH();
            CrNKTG.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = UserName;
            pav1.Add(padv1);
            CrNKTG.DataDefinition.ParameterFields["User"].ApplyCurrentValues(pav1);

            crystalReportViewer1.ReportSource = CrNKTG;
            crystalReportViewer1.Refresh();
        }
        public void report_NVL_TH(DataSet ds, string Ngay, string Nhom,string Users)
        {
            CrR_NVL_ReportTH CrKTGTH = new CrR_NVL_ReportTH();
            CrKTGTH.SetDataSource(ds.Tables[0]);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Ngay;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Ngay"].ApplyCurrentValues(pav1);
            ParameterValues pav2 = new ParameterValues();
            ParameterDiscreteValue padv2 = new ParameterDiscreteValue();
            padv2.Value = Nhom;
            pav2.Add(padv2);
            CrKTGTH.DataDefinition.ParameterFields["Nhom"].ApplyCurrentValues(pav2);
            ParameterValues pav3 = new ParameterValues();
            ParameterDiscreteValue padv3 = new ParameterDiscreteValue();
            padv3.Value = Users;
            pav3.Add(padv3);
            CrKTGTH.DataDefinition.ParameterFields["Users"].ApplyCurrentValues(pav3);


            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_HDLD_1Nam(DataTable ds, string NguoiSDLD, string ChucVu)
        {
            CrR_HDLD_1Nam CrKTGTH = new CrR_HDLD_1Nam();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = NguoiSDLD;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["NguoiSDLD"].ApplyCurrentValues(pav1);
            ParameterValues pav2 = new ParameterValues();
            ParameterDiscreteValue padv2 = new ParameterDiscreteValue();
            padv2.Value = ChucVu;
            pav2.Add(padv2);
            CrKTGTH.DataDefinition.ParameterFields["ChucVu"].ApplyCurrentValues(pav2);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_HDLD_KTH(DataTable ds, string NguoiSDLD, string ChucVu)
        {
            CrR_HDLD_KTH CrKTGTH = new CrR_HDLD_KTH();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = NguoiSDLD;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["NguoiSDLD"].ApplyCurrentValues(pav1);
            ParameterValues pav2 = new ParameterValues();
            ParameterDiscreteValue padv2 = new ParameterDiscreteValue();
            padv2.Value = ChucVu;
            pav2.Add(padv2);
            CrKTGTH.DataDefinition.ParameterFields["ChucVu"].ApplyCurrentValues(pav2);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_HDLD_TV(DataTable ds, string NguoiSDLD, string ChucVu)
        {
            CrR_HDLD_TV CrKTGTH = new CrR_HDLD_TV();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = NguoiSDLD;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["NguoiSDLD"].ApplyCurrentValues(pav1);
            ParameterValues pav2 = new ParameterValues();
            ParameterDiscreteValue padv2 = new ParameterDiscreteValue();
            padv2.Value = ChucVu;
            pav2.Add(padv2);
            CrKTGTH.DataDefinition.ParameterFields["ChucVu"].ApplyCurrentValues(pav2);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_TonMB(DataTable ds,string Ngay)
        {
            CrR_TonMB CrKTGTH = new CrR_TonMB();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Ngay;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Ngay"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_TonMB_KV2(DataTable ds, string Ngay)
        {
            CrR_TonDinhVi_new CrKTGTH = new CrR_TonDinhVi_new();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Ngay;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Ngay"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_TonMB_LapRap(DataTable ds, string Ngay)
        {
            CrR_TonLapRap CrKTGTH = new CrR_TonLapRap();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Ngay;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Ngay"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_TonMB_SauNhung(DataTable ds, string Ngay)
        {
            CrR_TonSauNhung CrKTGTH = new CrR_TonSauNhung();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Ngay;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Ngay"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
        public void report_TonMB_KV34(DataTable ds, string Ngay)
        {
            CrR_TonKV3 CrKTGTH = new CrR_TonKV3();
            CrKTGTH.SetDataSource(ds);
            ParameterValues pav1 = new ParameterValues();
            ParameterDiscreteValue padv1 = new ParameterDiscreteValue();
            padv1.Value = Ngay;
            pav1.Add(padv1);
            CrKTGTH.DataDefinition.ParameterFields["Ngay"].ApplyCurrentValues(pav1);
            crystalReportViewer1.ReportSource = CrKTGTH;
            crystalReportViewer1.Refresh();

        }
    }
}
